<template>
  <div>
    <h3>当前count的最新值：{{ count }}</h3>
    <h3>{{showNum}}</h3>
    <p></p>
    <button @click="btnHandle1">-1</button>
    <button @click="btnHandle2">-N</button>
    <button @click="subAsync">-1 Async</button>
    <button @click="subNAsync(5)">-N Async</button>
  </div>
</template>

<script>
import { mapState , mapMutations , mapActions , mapGetters } from 'vuex'
export default {
  data(){
    return {

    }
  },
  computed: {
    ...mapState(['count']),
    ...mapGetters(['showNum'])
  },
  methods: {
    ...mapMutations(['sub','subN']),
    ...mapActions(['subAsync', 'subNAsync']),
    btnHandle1(){
      this.sub();
    },
    btnHandle2(){
      this.subN(3);
    }
  }
}
</script>

<style scoped>

</style>
